package com.atguigu.jxc.controller;


import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.entity.OverflowList;
import com.atguigu.jxc.service.ListGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author 花鸟の虫鱼
 * @CreateDate 21/9/7 16:08
 * @Version 1.0
 * @Description TODO
 */
@RestController

public class ListGoodsController {

    @Autowired
    private ListGoodsService listGoodsService;

    /** 查询获取类型
     * @return 返回库存查询结果
     */
    @PostMapping("/goodsType/loadGoodsType")
    public String loadGoodsType() {
        return listGoodsService.selectLoadGoodsType();
    }


    /** 报损新增
     * @return 返回库存查询结果
     */
    @PostMapping("/damageListGoods/save")


    public ServiceVO saveDamageList(DamageList damageList, String damageListGoodsStr,
                                    @RequestParam(required = false) String damageNumber) {
        damageList.setDamageNumber(damageNumber);
        return listGoodsService.savedamageList(damageList,damageListGoodsStr);
    }
    /**
     * 报溢新增
     * @return 返回库存查询结果
     */
    @PostMapping("/overflowListGoods/save")
    public ServiceVO saveOverflowList(OverflowList overflowList, String overflowListGoodsStr,
                                                @RequestParam(required = false) String  overflowNumber) {
        overflowList.setOverflowNumber(overflowNumber);

        return listGoodsService.saveOverflowList(overflowList,overflowListGoodsStr);
    }



    /**
     * 报损库存查询
     * @return 返回库存查询结果
     */
    @PostMapping("/damageListGoods/list")
    public Map<String, Object> damageList(String sTime, String eTime) {
        return listGoodsService.selectdamageList(sTime,eTime);
    }
    /**
     * 报溢库存查询
     * @return 返回库存查询结果
     */
    @PostMapping("/overflowListGoods/list")
    public Map<String, Object> overflowList(String sTime,String eTime) {
        return listGoodsService.selectoverflowList(sTime,eTime);
    }



    /**
     * 报损库存明细查询
     * @return 返回库存查询结果
     */
    @PostMapping("/damageListGoods/goodsList")
    public Map<String, Object> damageListDetail(Integer damageListId) {
        return listGoodsService.selectdamageListDetail(damageListId);
    }
    /**
     * 报溢库存明细查询
     * @return 返回库存查询结果
     */
    @PostMapping("/overflowListGoods/goodsList")
    public Map<String, Object> overflowListDetail(Integer overflowListId) {
        return listGoodsService.selectoverflowListDetail(overflowListId);
    }





}
